package com.cps.match.connection;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;

import org.apache.commons.io.IOUtils;

public class MatchClientRequester {
	public String enquire(String endPoint, String request) throws IOException {
		HttpURLConnection conn;
		try {
			conn = ConnectionHelper.getInstance().createOpenAPIConnection(endPoint, request);
		} catch (Exception e) {
			throw new IOException("Establish connection failed.",e);
		} 
		InputStream in = conn.getInputStream();
		String content = IOUtils.toString(in);
		IOUtils.closeQuietly(in);
		return content;
	}
}
